<!--conf-->
<!--#excluded#conf
       <sample>
            <product version="2.0" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
--> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Context menu and complex drag-and-drop</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
</head>
<body>
	<h1>Context menu and complex drag-and-drop</h1>
<p>Left click on a tree node.
Drag and drop tree items within one tree or between trees.
Complex drag-n-drop allows you to reorder tree nodes within one level and at the same time supports drop as child behavior.</p>
	<table>
		<tr>
			<td>
				<div id="treeboxbox_tree" style="width:260px; height:260px;background-color:#f5f5f5;border :1px solid Silver;"/>
			</td>
			<td valign="top">
				<div id="treeboxbox_tree2" style="width:260px; height:260px;background-color:#f5f5f5;border :1px solid Silver;"/>
			</td>
		</tr>
		
	</table>


	<script>

	function onButtonClick(menuitemId,type){
	   	var id = tree.contextID;
                	tree.setItemColor(id,menuitemId.split("_")[1]);
		
	}
	function onButtonClick2(menuitemId,type){
	   	var id = tree2.contextID;
                	tree2.setItemColor(id,menuitemId.split("_")[1]);
		
	}

	menu = new dhtmlXMenuObject();
	menu.setIconsPath("../common/images/menu/");
	menu.renderAsContextMenu();
	menu.attachEvent("onClick",onButtonClick);
	menu.loadStruct("../common/_context.xml");

	tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);


	tree.setSkin('dhx_skyblue');
	tree.setImagePath("../../../codebase/imgs/dhxtree_skyblue/");
	tree.enableDragAndDrop(true);
	tree.enableContextMenu(menu);
	tree.enableSmartXMLParsing(true);
	tree.setDragBehavior("complex");
	tree.loadXML("../common/tree.xml")


	menu2 = new dhtmlXMenuObject();
	menu2.setIconsPath("../common/images/menu/");
	menu2.renderAsContextMenu();
	menu2.attachEvent("onClick",onButtonClick2);
	menu2.loadStruct("../common/_context.xml");
	
	tree2=new dhtmlXTreeObject("treeboxbox_tree2","100%","100%",0);

	
	tree2.setSkin('dhx_skyblue');
	tree2.setImagePath("../../../codebase/imgs/dhxtree_skyblue/");
	tree2.enableDragAndDrop(true);
	tree2.enableContextMenu(menu2);
	tree2.setDragBehavior("complex");
	tree2.loadXML("../common/tree.xml")




	</script>


</body>
</html>
